﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            string constr = "server=.;database=user;uid=sa;pwd=123456";
            SqlConnection conn = new SqlConnection(constr);
            string sql = "select * from commodity";
            SqlCommand cmd = new SqlCommand(sql,conn);
            conn.Open();
            var read = cmd.ExecuteReader();
            while (read.Read()) 
            {
                Console.WriteLine("{0}\t{1}\t{2}",read["commodityId"],read["commodityName"],read["price"]);
            }
            conn.Close();


        }
    }
}
